package com.qk.common.util;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import java.util.Date;
import java.util.Map;
public class JwtUtil {
    private static final long EXPIRE_TIME = 12 * 60 * 60 * 1000;
    private static final String SECRET_KEY = "wdj5asd1321dsaa25sd1jw";
    public static String generateToken(Map<String, Object> claims) {

        return Jwts.builder()
                .setExpiration(new Date(System.currentTimeMillis() + EXPIRE_TIME))
                .setClaims(claims)
                .signWith(SignatureAlgorithm.HS256, SECRET_KEY)
                .compact();
    }
    public static Claims parseToken(String token) {
        return Jwts.parser()
                .setSigningKey(SECRET_KEY)
                .parseClaimsJws(token)
                .getBody();
    }
}